﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel;
using Microsoft.ServiceBus;

using wcfTestClient.ServiceReference1;

namespace wcfTestClient
{
    class Program
    {
        static void Main(string[] args)
        {
            /*
            string issuerName = "owner";
            string issuerSecret = "d3cY1e1gMEY58rgQWsmFPPQYqfJRNmsBIoA/8lNfY3U=";
            string serviceNamespaceDomain = "convo498";

            var cf = new ChannelFactory<IConvoChannel>(
                new NetTcpRelayBinding(),
                new EndpointAddress(ServiceBusEnvironment.CreateServiceUri("sb", "convo498", "test")));

            cf.Endpoint.Behaviors.Add(new TransportClientEndpointBehavior { TokenProvider = TokenProvider.CreateSharedSecretTokenProvider("owner", issuerSecret) });

            using (var ch = cf.CreateChannel())
            {
                UserMessage me = ch.GetProfile("Sid");
                Console.WriteLine(me.Name + ": " + me.Email);
                ch.getFriends(me.id);
            }*/

            ConvoClient client = null;

            client = new ConvoClient();
            try
            {
                UserMessage msg = client.GetProfile("Sid");
                var friends = client.getFriends("3");

                Console.WriteLine(msg.Name + ": " + msg.Email);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception encounter: {0}",
                                   e.Message);
            }
            finally
            {
                if (null != client)
                {
                    client.Close();
                }
            }
            

        }
    }
}
